﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:47
 ******************************************************************************/

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
     using RDIFramework.Utilities;

     /// <summary>
     /// CiFileEntity
     /// 文件表
     ///
     /// 修改纪录
     ///
     ///		2012-03-02 版本：1.0 EricHu 创建主键。
     ///
     /// 版本：1.0
     ///
     /// <author>
     ///		<name>EricHu</name>
     ///		<date>2012-03-02</date>
     /// </author>
     /// </summary>
    [Serializable]
    public partial class CiFileEntity
    {
        private String id = null;
        /// <summary>
        /// 代码
        /// </summary>
        public String Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        private String folderId = null;
        /// <summary>
        /// 文件夹节点代码
        /// </summary>
        public String FolderId
        {
            get
            {
                return this.folderId;
            }
            set
            {
                this.folderId = value;
            }
        }

        private String fileName = string.Empty;
        /// <summary>
        /// 文件名
        /// </summary>
        public String FileName
        {
            get
            {
                return this.fileName;
            }
            set
            {
                this.fileName = value;
            }
        }

        private String filePath = string.Empty;
        /// <summary>
        /// 文件路径
        /// </summary>
        public String FilePath
        {
            get
            {
                return this.filePath;
            }
            set
            {
                this.filePath = value;
            }
        }

        private byte[] fileContent = null;
        /// <summary>
        /// 文件内容
        /// </summary>
        public byte[] FileContent
        {
            get
            {
                return this.fileContent;
            }
            set
            {
                this.fileContent = value;
            }
        }

        private Double? fileSize = 0;
        /// <summary>
        /// 文件大小
        /// </summary>
        public Double? FileSize
        {
            get
            {
                return this.fileSize;
            }
            set
            {
                this.fileSize = value;
            }
        }

        private String imageUrl = string.Empty;
        /// <summary>
        /// 图片文件位置
        /// </summary>
        public String ImageUrl
        {
            get
            {
                return this.imageUrl;
            }
            set
            {
                this.imageUrl = value;
            }
        }

        private int? readCount = 0;
        /// <summary>
        /// 被阅读次数
        /// </summary>
        public int? ReadCount
        {
            get
            {
                return this.readCount;
            }
            set
            {
                this.readCount = value;
            }
        }

        private String category = string.Empty;
        /// <summary>
        /// 文件类别
        /// </summary>
        public String Category
        {
            get
            {
                return this.category;
            }
            set
            {
                this.category = value;
            }
        }

        private String description = string.Empty;
        /// <summary>
        /// 描述
        /// </summary>
        public String Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        private int? enabled = 1;
        /// <summary>
        /// 有效
        /// </summary>
        public int? Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        private string sortCode = string.Empty;
        /// <summary>
        /// 排序码
        /// </summary>
        public string SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        private int? deleteMark = 0;
        /// <summary>
        /// 删除标志
        /// </summary>
        public int? DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        private DateTime? createOn = DateTime.Now;
        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateOn
        {
            get
            {
                return this.createOn;
            }
            set
            {
                this.createOn = value;
            }
        }

        private String createUserId = string.Empty;
        /// <summary>
        /// 创建用户主键
        /// </summary>
        public String CreateUserId
        {
            get
            {
                return this.createUserId;
            }
            set
            {
                this.createUserId = value;
            }
        }

        private String createBy = string.Empty;
        /// <summary>
        /// 创建用户
        /// </summary>
        public String CreateBy
        {
            get
            {
                return this.createBy;
            }
            set
            {
                this.createBy = value;
            }
        }

        private DateTime? modifiedOn = null;
        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? ModifiedOn
        {
            get
            {
                return this.modifiedOn;
            }
            set
            {
                this.modifiedOn = value;
            }
        }

        private String modifyUserId = string.Empty;
        /// <summary>
        /// 修改用户主键
        /// </summary>
        public String ModifyUserId
        {
            get
            {
                return this.modifyUserId;
            }
            set
            {
                this.modifyUserId = value;
            }
        }

        private String modifiedBy = string.Empty;
        /// <summary>
        /// 修改用户
        /// </summary>
        public String ModifiedBy
        {
            get
            {
                return this.modifiedBy;
            }
            set
            {
                this.modifiedBy = value;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public CiFileEntity()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public CiFileEntity(DataRow dataRow)
        {
            this.GetFrom(dataRow);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public CiFileEntity(IDataReader dataReader)
        {
            this.GetFrom(dataReader);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public CiFileEntity(DataTable dataTable)
        {
            this.GetFrom(dataTable);
        }

        /// <summary>
        /// 从数据表读取
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public CiFileEntity GetFrom(DataTable dataTable)
        {
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                return null;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                this.GetFrom(dataRow);
                break;
            }
            return this;
        }

        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public CiFileEntity GetFrom(DataRow dataRow)
        {
            this.Id = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldId]);
            this.FolderId = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldFolderId]);
            this.FileName = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldFileName]);
            this.FilePath = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldFilePath]);
            this.FileSize = BusinessLogic.ConvertToDouble(dataRow[CiFileTable.FieldFileSize]);
            this.FileContent = BusinessLogic.ConvertToByte(dataRow[CiFileTable.FieldFileContent]);
            this.ImageUrl = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldImageUrl]);
            this.ReadCount = BusinessLogic.ConvertToInt(dataRow[CiFileTable.FieldReadCount]);
            this.Category = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldCategory]);
            this.Description = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldDescription]);
            this.Enabled = BusinessLogic.ConvertToInt(dataRow[CiFileTable.FieldEnabled]);
            this.SortCode = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldSortCode]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[CiFileTable.FieldDeleteMark]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[CiFileTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[CiFileTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[CiFileTable.FieldModifiedBy]);
            return this;
        }

        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public CiFileEntity GetFrom(IDataReader dataReader)
        {
            this.Id = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldId]);
            this.FolderId = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldFolderId]);
            this.FileName = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldFileName]);
            this.FilePath = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldFilePath]);
            this.FileSize = BusinessLogic.ConvertToDouble(dataReader[CiFileTable.FieldFileSize]);
            this.FileContent = BusinessLogic.ConvertToByte(dataReader[CiFileTable.FieldFileContent]);
            this.ImageUrl = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldImageUrl]);
            this.ReadCount = BusinessLogic.ConvertToInt(dataReader[CiFileTable.FieldReadCount]);
            this.Category = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldCategory]);
            this.Description = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldDescription]);
            this.Enabled = BusinessLogic.ConvertToInt(dataReader[CiFileTable.FieldEnabled]);
            this.SortCode = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldSortCode]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[CiFileTable.FieldDeleteMark]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[CiFileTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[CiFileTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[CiFileTable.FieldModifiedBy]);
            return this;
        }
    }
}
